package com.scu.hotelsystem.dao;

import com.scu.hotelsystem.pojo.GoodsOrder;
import com.scu.hotelsystem.service.GoodsOrderService;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public interface GoodsOrderDao {
    @Select("select * from goods_order")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "guestId", column = "guestId"),
            @Result(property = "staffId", column = "staffId"),
            @Result(property = "addTime", column = "addTime"),
            @Result(property = "isPaid", column = "isPaid"),
            @Result(property = "total", column = "total"),
            @Result(property = "tag", column = "tag")
    })
    public List<GoodsOrder> findAll() throws Exception;

    //jia多表操作
    @Select("select * from goods_order where id=#{ordersId}")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "guestId", column = "guestId"),
            @Result(property = "staffId", column = "staffId"),
            @Result(property = "addTime", column = "addTime"),
            @Result(property = "isPaid", column = "isPaid"),
            @Result(property = "total", column = "total"),
            @Result(property = "tag", column = "tag")
    })

    public GoodsOrder findById(Integer ordersId) throws Exception;
}
